package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.anno.AutoFill;
import com.sky.dto.DishDTO;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import com.sky.vo.ShoppingParamVO;
import org.apache.ibatis.annotations.Mapper;


import java.util.List;

@Mapper
public interface DishMapper {
    Page<DishVO> findPage(DishPageQueryDTO searchDto);

    /**
     * 根据分类id查询菜品数量
     * @param categoryId
     * @return
     */
  //  @Select("select count(id) from dish where category_id = #{categoryId}")
    Integer countByCategoryId(Long categoryId);
    Integer deleteById(List ids);
    @AutoFill(value = OperationType.INSERT)
    Integer save(Dish dto);
    DishVO  findById(Long id);
    @AutoFill(value = OperationType.UPDATE)
    Integer updateDish(Dish dto);

    @AutoFill(value = OperationType.UPDATE)
    Integer updtDishStatus(Dish dish);
    List<Dish> findByIds(List ids);

    //Setmeal dishIsInSetmeal(Integer id);
    @AutoFill(value = OperationType.UPDATE)
    int updateDishStatus(Dish dish);
    @AutoFill(value = OperationType.UPDATE)
    int updateStatus(Dish dish);

    List<DishVO> findByCategoryId(String categoryId);

    Integer dishIsInSetmeal(Integer id);

    List<DishVO> findDishByCategoryId(Integer categoryId);

    ShoppingParamVO findShoppingById(Long dishId);

    Integer selectDishByStatus(int i);

}
